version 10.0
log using "C:\fsu2010\formateur\replication\stata_mxl.log", replace
#delimit ;
set mem 30m;
clear matrix;
clear mata;

set more off;

*     ***************************************************************** *;
*     ***************************************************************** *;
*       File-Name:  stata_mxl.do                                        *;
*       Date:       November 5, 2010                                    *;
*       Author:     GG/MG                                               *;
*       Purpose:    Produce Tables 1 and 2 in AJPS paper                *;
*       Input File:     europe.dta                                      *;
*       Output File:    stata_mxl.log                                   *;
*       Data Output:    none                                            *;
*       Previous file:  europe.dta                                      *;
*       Machine:        Matt's desktop                                  *;
*     ****************************************************************  *;
*     ****************************************************************  *;

use "C:\fsu2010\formateur\replication\europe.dta", clear;

*     ****************************************************************  *;
*       Produce the results shown in Tables 1 and 2.  The LR tests      *;
*       compare each of the 6 models to a model where we only include   *;
*       largest party as an independent variable.                       *;
*     ****************************************************************  *;

*     ****************************************************************  *;
*       Model 1: Western Europe (with LR test)                          *;
*     ****************************************************************  *;

mixlogit choice largestparty_east party_seatshare_east,  
    rand (largestparty party_seatshare) ln(0) nrep(125) group(cabinetcode);
    
estimates store A;

constraint 1 [SD]party_seatshare = 0;
constraint 2 party_seatshare = 0;
constraint 3 party_seatshare_east = 0;

mixlogit choice largestparty_east party_seatshare_east,   
    rand (largestparty party_seatshare) ln(0) nrep(125) group(cabinetcode) constraints(1 2 3) 
    from(largestparty_east =-0.772611 party_seatshare_east =0.0996268 largestparty=1.027553 party_seatshare=0.1369203);
    
estimates store B;

lrtest A B;
      
*     ****************************************************************  *;
*       Model 1: Eastern Europe                                         *;
*     ****************************************************************  *;

mixlogit choice largestparty_west party_seatshare_west,  
    rand (largestparty party_seatshare) ln(0) nrep(125) group(cabinetcode);
    

*     ****************************************************************  *;
*       Model 2: Western Europe (with LR test)                          *;
*     ****************************************************************  *;

mixlogit choice largestparty_east party_seatshare_east medianparty1_east,  
    rand (largestparty party_seatshare medianparty1) ln(0) nrep(125) group(cabinetcode);
    
estimates store A;

constraint 1 [SD]party_seatshare = 0;
constraint 2 party_seatshare = 0;
constraint 3 party_seatshare_east = 0;
constraint 4 [SD]medianparty1 = 0;
constraint 5 medianparty1 = 0;
constraint 6 medianparty1_east = 0;

mixlogit choice largestparty_east party_seatshare_east medianparty1_east,  
    rand (largestparty party_seatshare medianparty1) ln(0) nrep(125) group(cabinetcode) constraints(1 2 3 4 5 6) 
    from(largestparty_east =-1.070898 party_seatshare_east =0.1923742 medianparty1_east=-1.452603  largestparty=0.7065556 party_seatshare=0.1172551 medianparty1=0.9396789);
    
estimates store B;

lrtest A B;

*     ****************************************************************  *;
*       Model 2: Eastern Europe                                         *;
*     ****************************************************************  *;

mixlogit choice largestparty_west party_seatshare_west medianparty1_west,  
    rand (largestparty party_seatshare medianparty1) ln(0) nrep(125) group(cabinetcode);

*     ****************************************************************  *;
*       Model 3: Western Europe (with LR test)                          *;
*     ****************************************************************  *;

mixlogit choice largestparty_east party_seatshare_east medianparty1_east presidentparty_east,  
    rand (largestparty party_seatshare medianparty1 presidentparty) ln(0) nrep(125) group(cabinetcode);
    
estimates store A;

constraint 1 [SD]party_seatshare = 0;
constraint 2 party_seatshare = 0;
constraint 3 party_seatshare_east = 0;
constraint 4 [SD]medianparty1 = 0;
constraint 5 medianparty1 = 0;
constraint 6 medianparty1_east = 0;
constraint 7 [SD]presidentparty = 0;
constraint 8 presidentparty = 0;
constraint 9 presidentparty_east = 0;

mixlogit choice largestparty_east party_seatshare_east medianparty1_east presidentparty_east,  
    rand (largestparty party_seatshare medianparty1 presidentparty) ln(0) nrep(125) group(cabinetcode) constraints(1 2 3 4 5 6 7 8 9) 
    from(largestparty_east =-1.225344 party_seatshare_east=0.2197665 medianparty1_east=-1.380664  presidentparty_east=0.280208 
    largestparty=0.9123011 party_seatshare=0.1236354 medianparty1=1.004963 presidentparty=0.6269142);
    
estimates store B;

lrtest A B;

*     ****************************************************************  *;
*       Model 3: Eastern Europe                                         *;
*     ****************************************************************  *;

mixlogit choice largestparty_west party_seatshare_west medianparty1_west presidentparty_west,  
    rand (largestparty party_seatshare medianparty1 presidentparty) ln(0) nrep(125) group(cabinetcode);
    
*     ****************************************************************  *;
*       Model 4: Western Europe (with LR test)                          *;
*     ****************************************************************  *;

mixlogit choice largestparty_east party_seatshare_east medianparty1_east presidentparty_east previousPM_east,  
    rand (largestparty party_seatshare medianparty1 presidentparty previousPM) ln(0) nrep(125) group(cabinetcode);
    
estimates store A;

constraint 1 [SD]party_seatshare = 0;
constraint 2 party_seatshare = 0;
constraint 3 party_seatshare_east = 0;
constraint 4 [SD]medianparty1 = 0;
constraint 5 medianparty1 = 0;
constraint 6 medianparty1_east = 0;
constraint 7 [SD]presidentparty = 0;
constraint 8 presidentparty = 0;
constraint 9 presidentparty_east = 0;
constraint 10 [SD]previousPM = 0;
constraint 11 previousPM = 0;
constraint 12 previousPM_east = 0;

mixlogit choice largestparty_east party_seatshare_east medianparty1_east presidentparty_east previousPM_east,  
    rand (largestparty party_seatshare medianparty1 presidentparty previousPM) ln(0) nrep(125) group(cabinetcode) constraints(1 2 3 4 5 6 7 8 9 10 11 12) 
    from(largestparty_east =-1.211664 party_seatshare_east=0.224388 medianparty1_east=-1.17119  presidentparty_east=0.3653009 previousPM_east=-1.358147 
    largestparty=0.8590721 party_seatshare=0.1171662 medianparty1=1.072249 presidentparty=0.5785964 previousPM=0.6955045);
    
estimates store B;

lrtest A B;

*     ****************************************************************  *;
*       Model 4: Eastern Europe                                         *;
*     ****************************************************************  *;

mixlogit choice largestparty_west party_seatshare_west medianparty1_west presidentparty_west previousPM_west,  
    rand (largestparty party_seatshare medianparty1 presidentparty previousPM) ln(0) nrep(125) group(cabinetcode);
    
*     ****************************************************************  *;
*       Model 5: Western Europe (with LR test)                          *;
*     ****************************************************************  *;

mixlogit choice largestparty_east party_seatshare_east medianparty1_east presidentparty_east previousPM_east,   
    rand (largestparty party_seatshare medianparty1 presidentparty previousPM president_investiture president_direct) ln(0) nrep(125) group(cabinetcode);
    
   
*     ****************************************************************  *;
*       Model 5 for Western Europe reaches a local maximum and so we    *;
*       need to give it better starting values.  We use the starting    *;
*       values based on the results from Model 5 for Western Europe     *;
*       except that we use the coefficient estimates on the president   *;
*       interaction term from Model 5 for Eastern Europe.               *;
*     ****************************************************************  *;

mixlogit choice largestparty_east party_seatshare_east medianparty1_east presidentparty_east previousPM_east,    
    rand (largestparty party_seatshare medianparty1 presidentparty previousPM president_investiture president_direct) ln(0) nrep(125) group(cabinetcode) 
    from(largestparty_east =-1.403309 party_seatshare_east =0.2506177 medianparty1_east =-1.441322 presidentparty_east =0.9270295 
    previousPM_east =-1.228084 largestparty=1.002409 party_seatshare=0.1165616 medianparty1=1.081568 presidentparty=3.408346 
    previousPM=0.7209862 president_investiture= -2.267492 president_direct= -2.237836);
    
estimates store A;

constraint 1 [SD]party_seatshare = 0;
constraint 2 party_seatshare = 0;
constraint 3 party_seatshare_east = 0;
constraint 4 [SD]medianparty1 = 0;
constraint 5 medianparty1 = 0;
constraint 6 medianparty1_east = 0;
constraint 7 [SD]presidentparty = 0;
constraint 8 presidentparty = 0;
constraint 9 presidentparty_east = 0;
constraint 10 [SD]previousPM = 0;
constraint 11 previousPM = 0;
constraint 12 previousPM_east = 0;
constraint 13 [SD]president_investiture = 0;
constraint 14 president_investiture = 0;
constraint 15 [SD]president_direct = 0;
constraint 16 president_direct = 0;

mixlogit choice largestparty_east party_seatshare_east medianparty1_east presidentparty_east previousPM_east,   
    rand (largestparty party_seatshare medianparty1 presidentparty previousPM president_investiture president_direct) ln(0) nrep(125) group(cabinetcode) 
    constraints(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16) 
    from(largestparty_east =-1.403309 party_seatshare_east =0.2506177 medianparty1_east =-1.441322 presidentparty_east =0.9270295 
    previousPM_east =-1.228084 largestparty=1.002409 party_seatshare=0.1165616 medianparty1=1.081568 presidentparty=3.408346 
    previousPM=0.7209862 president_investiture= -2.267492 president_direct= -2.237836);
    
estimates store B;

lrtest A B;

*     ****************************************************************  *;
*       Model 5: Eastern Europe                                         *;
*     ****************************************************************  *;

mixlogit choice largestparty_west party_seatshare_west medianparty1_west presidentparty_west previousPM_west,   
    rand (largestparty party_seatshare medianparty1 presidentparty previousPM president_investiture president_direct) ln(0) nrep(125) group(cabinetcode);
    
*     ****************************************************************  *;
*       Model 6: Western Europe (with LR test)                          *;
*     ****************************************************************  *;

mixlogit choice largestparty_east party_seatshare_east medianparty1_east presidentparty_east previousPM_east previousPM_conflict_east previousPM_gain1_east previous_cabinet_gain1_east,  
    rand (largestparty party_seatshare medianparty1 presidentparty previousPM president_investiture president_direct previousPM_conflict previousPM_gain1 previous_cabinet_gain1) 
    ln(0) nrep(125) group(cabinetcode);

estimates store A;

constraint 1 [SD]party_seatshare = 0;
constraint 2 party_seatshare = 0;
constraint 3 party_seatshare_east = 0;
constraint 4 [SD]medianparty1 = 0;
constraint 5 medianparty1 = 0;
constraint 6 medianparty1_east = 0;
constraint 7 [SD]presidentparty = 0;
constraint 8 presidentparty = 0;
constraint 9 presidentparty_east = 0;
constraint 10 [SD]previousPM = 0;
constraint 11 previousPM = 0;
constraint 12 previousPM_east = 0;
constraint 13 [SD]president_investiture = 0;
constraint 14 president_investiture = 0;
constraint 15 [SD]president_direct = 0;
constraint 16 president_direct = 0;
constraint 17 [SD]previousPM_conflict = 0;
constraint 18 previousPM_conflict = 0;
constraint 19 previousPM_conflict_east = 0;
constraint 20 [SD]previousPM_gain1 = 0;
constraint 21 previousPM_gain1 = 0;
constraint 22 previousPM_gain1_east = 0;
constraint 23 [SD]previous_cabinet_gain1 = 0;
constraint 24 previous_cabinet_gain1 = 0;
constraint 25 previous_cabinet_gain1_east = 0;

mixlogit choice largestparty_east party_seatshare_east medianparty1_east presidentparty_east previousPM_east previousPM_conflict_east previousPM_gain1_east previous_cabinet_gain1_east,  
    rand (largestparty party_seatshare medianparty1 presidentparty previousPM president_investiture president_direct previousPM_conflict previousPM_gain1 previous_cabinet_gain1) 
    ln(0) nrep(125) group(cabinetcode) constraints(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25) 
    from(largestparty_east =-1.253544 party_seatshare_east=0.2877481 medianparty1_east =-3.117227 presidentparty_east =0.4970681 
    previousPM_east =-2.19965 previousPM_conflict_east=1.126725 previousPM_gain1_east=-0.0930831 previous_cabinet_gain1_east=0.0517841
    largestparty=2.109019 party_seatshare=0.1351541 medianparty1=1.392319 presidentparty=5.250695 
    previousPM=2.841572 president_investiture= -3.060496 president_direct= -3.915977 previousPM_conflict=-2.618633 previousPM_gain1=0.4958572 previous_cabinet_gain1=0.0367127);
    
estimates store B;

lrtest A B;

*     ****************************************************************  *;
*       Model 6: Eastern Europe                                         *;
*     ****************************************************************  *;

mixlogit choice largestparty_west party_seatshare_west medianparty1_west presidentparty_west previousPM_west previousPM_conflict_west previousPM_gain1_west previous_cabinet_gain1_west,  
    rand (largestparty party_seatshare medianparty1 presidentparty previousPM president_investiture president_direct previousPM_conflict previousPM_gain1 previous_cabinet_gain1) 
    ln(0) nrep(125) group(cabinetcode);


log close;



  


